package com.tw.academy.basic.$2_magic_number;

public class FareCalculation {

    public static final int DISCOUNT_RANGE_ONE_MIN = 100;
    public static final int DISCOUNT_RANGE_ONE_MAX = 150;
    public static final int DISCOUNT_RANGE_TWO_MAX = 400;
    public static final Double RANGE_ONE_DISCOUNT = 0.8;
    public static final Double RANGE_TWO_DISCOUNT = 0.5;

    public double calculate(double originalPrice, double cumulativeExpensesThisMonth) {
        if (cumulativeExpensesThisMonth >= DISCOUNT_RANGE_ONE_MIN && cumulativeExpensesThisMonth < DISCOUNT_RANGE_ONE_MAX) {
            return originalPrice * RANGE_ONE_DISCOUNT;
        }
        if (cumulativeExpensesThisMonth >= DISCOUNT_RANGE_ONE_MAX && cumulativeExpensesThisMonth < DISCOUNT_RANGE_TWO_MAX) {
            return originalPrice * RANGE_TWO_DISCOUNT;
        }
        return originalPrice;
    }
}
